#!/bin/bash
PREFIX=~
MENU=.music-menu
NEW=.music-new
SEL=`cat "$PREFIX/$MENU" | dmenu`
if test -n "$SEL"; then
	SEL=`cat "$PREFIX/$MENU" | awk "/$SEL/ {print}"`
fi
if test -n "$SEL"; then
	music-"$SEL"
	echo "$SEL" > "$PREFIX/$NEW"
	cat "$PREFIX/$MENU" | awk "! /$SEL/ {print}" >> "$PREFIX/$NEW"
	cp "$PREFIX/$NEW" "$PREFIX/$MENU"
	rm "$PREFIX/$NEW"
fi

